package com.sunny.ynhz.ui.lake;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sunny.ynhz.R;
import com.sunny.ynhz.adapter.base.ViewPageFragmentAdapter;


import java.util.ArrayList;
import java.util.List;

/**
 * Created by huhuan123 on 2018/5/21.
 */

public class PatrolRiverFragment extends Fragment {

    private ViewPager viewPager;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.patrol_river_fragment, null);
        viewPager = view.findViewById(R.id.vp_patrol_river);
        TabLayout mTabLayout = view.findViewById(R.id.tab_title);
        mTabLayout.setupWithViewPager(viewPager);
        PatrolRiverProblemFragment patrolRiverProblemFragment = new PatrolRiverProblemFragment();
        Bundle bundle = new Bundle();
        bundle.putString("type", "HA012");
        patrolRiverProblemFragment.setArguments(bundle);
        PatrolRiverRouteFragment patrolRiverRouteFragment = new PatrolRiverRouteFragment();
        Bundle bundlepatrolRiverRouteFragment = new Bundle();
        bundlepatrolRiverRouteFragment.putString("type", "HA012");
        patrolRiverRouteFragment.setArguments(bundlepatrolRiverRouteFragment);
        List<Fragment> list = new ArrayList<>();
        list.add(patrolRiverProblemFragment);
        list.add(patrolRiverRouteFragment);
        ViewPageFragmentAdapter viewPageFragmentAdapter = new ViewPageFragmentAdapter(getChildFragmentManager(), list, new String[]{"巡河问题", "巡河轨迹"});
        viewPager.setAdapter(viewPageFragmentAdapter);

        return view;
    }

}
